package com.ycw.servlet.wangwang;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.ycw.dao.ContractDao;
import com.ycw.dao.impl.ContractDaoImpl;

@WebServlet("/getHidByRVURServlet")
public class dogetHidByRVURServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ContractDao cd = new ContractDaoImpl();
		String hregion = request.getParameter("h_region");
		String hvillage = request.getParameter("h_village");
		String hunit = request.getParameter("h_unit");
		String hroomnum = request.getParameter("h_roomnum");
		int hid = cd.getHid(hregion, hvillage, hunit, hroomnum);

		// 向前端发送JSON数据
		String resJSON = JSON.toJSONString(hid);
		PrintWriter out = response.getWriter();
		out.write(resJSON);
		out.close();
	}
}
